import { Label } from "cc";
import { _decorator, Component, Node,JsonAsset } from "cc";
import { LocalizeManager } from "./LocalizeManager";
import { resources } from "cc";
import ResManager from "../ResManager";
import { SpriteFrame } from "cc";
const { ccclass, property,executeInEditMode,disallowMultiple,menu } = _decorator;

@ccclass("LocailzeLabel")
// @executeInEditMode(true)
@disallowMultiple(true)
@menu("Locail/LocailzeLabel")
export class LocailzeLabel extends Component {
  @property
  key: string = "";



  protected start(): void {

    if (this.key) {
      const label = this.node.getComponent(Label);
      LocalizeManager.updateStyle(label, this.key);
    }
  }

  updateStyle(text: string) {
    this.key = text;
    LocalizeManager.updateStyle(this.node.getComponent(Label), text);
  }
}
